package com.mj;

import com.mj.printer.BinaryTrees;
import com.mj.tree.AVLTree;
import com.mj.tree.RBTree;

public class Main {

    static void test1() {
        AVLTree<Integer> avl = new AVLTree<>();
        Integer[] data = {19, 28, 7, 51, 29, 16, 59};

        for (int i = 0; i < data.length; i++) {
            avl.add(data[i]);
        }
        avl.remove(19);
        avl.remove(28);
//            avl.remove(51);
        BinaryTrees.println(avl);
        System.out.println("---------------------------");

//        for (int i = 0; i < data.length; i++) {
//            System.out.println("【"+data[i]+"】");
//            avl.remove(data[i]);
//            BinaryTrees.println(avl);
//            System.out.println("---------------------------");
//        }
    }

        static void test2() {
        RBTree<Integer> rbTree = new RBTree<>();
        Integer[] data = {15, 41, 46, 33, 4, 83, 81, 11};

        for (int i = 0; i < data.length; i++) {
            rbTree.add(data[i]);
            System.out.println("【"+data[i]+"】");
            BinaryTrees.println(rbTree);
            System.out.println("---------------------------");
        }

        BinaryTrees.println(rbTree);

    }
    static void test3(){


    }

    public static void main(String[] args) {
        test2();
        }

}
